package cn.chenxiejia;

import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @version : V1.0
 * @program: maven
 * @ClassName: Zi
 * @Description:
 * @Author: chenxiejia
 * @Date: 2022/1/31 23:13
 */
public class Zi {
    public static void main(String[] args) {

        try {
            BufferedReader br = new BufferedReader(new FileReader("F:/练.txt"));

            FileWriter bw = new FileWriter("F:/aa.txt", true);
            Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5,、\\d()（）].*");
            while (br.ready()) {
                String s = br.readLine();
                if (!s.matches(".*[\\u4e00-\\u9fa5].*")) {
                    bw.write(s);
                }
                Matcher matcher = pattern.matcher(s);

                while (matcher.find()) {
                    //System.out.println(matcher.group());
                    var ss = s.replace(matcher.group(), "");
                    bw.write(String.format(" %s", ss));
                }
            }
            bw.flush();
            bw.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
